package com.bjbn.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.bjbn.entity.BridgeAirConditioningInfoHistory;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 廊桥_飞机空调信息_历史模型Mapper接口
 */
@Mapper
public interface BridgeAirConditioningInfoHistoryMapper extends BaseMapper<BridgeAirConditioningInfoHistory> {

    /**
     * 统计总记录数
     */
    @Select("SELECT COUNT(*) FROM bridge_air_conditioning_info_history")
    Long countTotal();

    /**
     * 分页查询
     */
    @Select("SELECT * FROM bridge_air_conditioning_info_history LIMIT #{offset}, #{limit}")
    List<BridgeAirConditioningInfoHistory> selectPage(int offset, int limit);

    /**
     * 根据设备名称查询
     */
    @Select("SELECT * FROM bridge_air_conditioning_info_history WHERE DEVICE_NAME LIKE CONCAT('%', #{deviceName}, '%')")
    List<BridgeAirConditioningInfoHistory> findByDeviceNameContaining(String deviceName);

    /**
     * 根据厂家查询
     */
    @Select("SELECT * FROM bridge_air_conditioning_info_history WHERE BRAND = #{brand}")
    List<BridgeAirConditioningInfoHistory> findByBrand(String brand);

    /**
     * 根据区域查询
     */
    @Select("SELECT * FROM bridge_air_conditioning_info_history WHERE AREA = #{area}")
    List<BridgeAirConditioningInfoHistory> findByArea(String area);

    /**
     * 根据设备组查询
     */
    @Select("SELECT * FROM bridge_air_conditioning_info_history WHERE DEVICE_GROUP = #{deviceGroup}")
    List<BridgeAirConditioningInfoHistory> findByDeviceGroup(String deviceGroup);

    /**
     * 根据设备状态查询
     */
    @Select("SELECT * FROM bridge_air_conditioning_info_history WHERE STA = #{sta}")
    List<BridgeAirConditioningInfoHistory> findBySta(String sta);

    /**
     * 根据IP地址查询
     */
    @Select("SELECT * FROM bridge_air_conditioning_info_history WHERE IP = #{ip}")
    List<BridgeAirConditioningInfoHistory> findByIp(String ip);

    /**
     * 根据责任部门查询
     */
    @Select("SELECT * FROM bridge_air_conditioning_info_history WHERE DEPT = #{dept}")
    List<BridgeAirConditioningInfoHistory> findByDept(String dept);

    /**
     * 根据时间范围查询
     */
    @Select("SELECT * FROM bridge_air_conditioning_info_history WHERE BN_CREATE_TIME BETWEEN #{startTime} AND #{endTime}")
    List<BridgeAirConditioningInfoHistory> findByTimeRange(java.time.LocalDateTime startTime, java.time.LocalDateTime endTime);
}
